﻿Imports System.Data

Partial Class Default2
    Inherits System.Web.UI.Page
    Dim ocnAlumno As New Negocio.Alumno()

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            Me.GridView1.DataSource = ocnAlumno.BuscarAlumno(Me.TBdni.Text)
            Me.GridView1.DataBind()

            Dim ds As New DataSet
            ds = ocnAlumno.BuscarAlumno(Me.TBdni.Text)
            Me.TBnombre.Text = ds.Tables("Alumno").Rows(0)(0)
            Me.TBfechanac.Text = ds.Tables("Alumno").Rows(0)(2)
            Me.TBemail.Text = ds.Tables("Alumno").Rows(0)(3)
            Me.TBdomicilio.Text = ds.Tables("Alumno").Rows(0)(4)
            Me.RBlista.Text = ds.Tables("Alumno").Rows(0)(5)
        Catch ex As Exception
            Session.Add("Error", ex.Message)
            Response.Redirect("ManejarErrores.aspx")
        End Try
    End Sub

    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        Try
            ocnAlumno.ModificarAlumno(Me.TBdni.Text, Me.TBnombre.Text, Me.TBfechanac.Text, Me.TBemail.Text, Me.TBdomicilio.Text, Me.RBlista.Text)
            Me.GridView1.DataSource = ocnAlumno.BuscarAlumno(Me.TBdni.Text)
            Me.GridView1.DataBind()
        Catch ex As Exception
            Session.Add("Error", ex.Message)
            Response.Redirect("ManejarErrores.aspx")
        End Try
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub
End Class
